﻿<%@ Page Language="C#" MasterPageFile="~/WebShop.master" AutoEventWireup="true" CodeFile="OrderFilmDetail.aspx.cs"
    Inherits="Shopping_Order_OrderFilmDetail" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="div_skin-tango">
        <table border="0" cellpadding="0" cellspacing="0" width="100%">
            <tr>
                <td align="center">
                    <div class="coverlblTitleProduct">
                        <asp:Label ID="Label1" runat="server" Text="Chi tiết đơn đặt hàng của bạn" CssClass="lblTitleProduct"></asp:Label></div>
                </td>
            </tr>
            <tr>
                <td>
                    <div width="100%" align="center">
                        <table border="0" cellpadding="2" cellspacing="0" width="100%" class="tbl_ContentNews">
                            <tr>
                                <td align="left" class="td_ContentNews">
                                    <table border="0" cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td align="left">
                                                <asp:CheckBox ID="chkState" runat="server" Text="Thay đổi thông tin của bạn" Checked="False"
                                                    onclick="fnEditPerson(this)" Style="color: #0395CC" /></td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <table border="0" cellpadding="2" cellspacing="0" style="width: 100%;">
                                                    <tr>
                                                        <td nowrap="nowrap" class="td_GuestInfo" align="right">
                                                            Họ tên:</td>
                                                        <td nowrap="nowrap" align="left">
                                                            <asp:TextBox ID="txtHoTen" runat="server" CssClass="TextBoxToLabel" Width="222px"
                                                                ValidationGroup="grCustomer"></asp:TextBox>
                                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtHoTen"
                                                                ErrorMessage="Nhập vào tên khách hàng" ValidationGroup="grCustomer" ForeColor="Red">*</asp:RequiredFieldValidator></td>
                                                    </tr>
                                                    <tr style="color: #ffffff">
                                                        <td nowrap="nowrap" class="td_GuestInfo" align="right">
                                                            Địa chỉ:</td>
                                                        <td nowrap="nowrap" align="left">
                                                            <asp:TextBox ID="txtDiaChi" runat="server" CssClass="TextBoxToLabel" Width="224px"
                                                                ValidationGroup="grCustomer"></asp:TextBox>
                                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtDiaChi"
                                                                ErrorMessage="Nhập vào địa chỉ" ValidationGroup="grCustomer" ForeColor="Red">*</asp:RequiredFieldValidator></td>
                                                    </tr>
                                                    <tr style="color: #ffffff">
                                                        <td nowrap="nowrap" class="td_GuestInfo" align="right">
                                                            Điện thoại:</td>
                                                        <td nowrap="nowrap" align="left">
                                                            <asp:TextBox ID="txtDienThoai" runat="server" CssClass="TextBoxToLabel" Width="150px"
                                                                ValidationGroup="grCustomer"></asp:TextBox>
                                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtDienThoai"
                                                                ErrorMessage="Nhập vào điện thoại" ValidationGroup="grCustomer" ForeColor="Red">*</asp:RequiredFieldValidator>
                                                            <asp:Label ID="lblBirthDay" runat="server" Text="" Visible="false"></asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td nowrap="nowrap" class="td_GuestInfo" align="right">
                                                            Email:</td>
                                                        <td nowrap="nowrap" align="left">
                                                            <asp:TextBox ID="txtEmail" runat="server" CssClass="TextBoxToLabel" Width="203px"
                                                                onblur="fnCheckEmail(this.value)" onkeyup="fnHideImgEmail()" ValidationGroup="grCustomer"></asp:TextBox>
                                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtEmail"
                                                                ErrorMessage="Nhập vào Email" ValidationGroup="grCustomer" ForeColor="Red">*</asp:RequiredFieldValidator>
                                                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtEmail"
                                                                ErrorMessage="Yêu cầu nhập chính xác địa chỉ Email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                                                ValidationGroup="grCustomer" ForeColor="Red">*</asp:RegularExpressionValidator>&nbsp;
                                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator51" runat="server" ControlToValidate="hidEmail"
                                                                ErrorMessage="Email này đã được sử dụng" InitialValue="0" ValidationGroup="grCustomer"
                                                                CssClass="valid_common"> &nbsp;</asp:RequiredFieldValidator>&nbsp;
                                                            <img src="../../Images/Icon/spinner.gif" border="0" id="imgStateEmail" style="visibility: hidden" />
                                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator52" runat="server" ControlToValidate="hidEmail"
                                                                ErrorMessage="Đang xử lý..." ValidationGroup="grCustomer" CssClass="valid_common">Đang xử lý...</asp:RequiredFieldValidator>
                                                            <asp:TextBox ID="hidEmail" runat="server" CssClass="cssHidden" Text="1" Width="5px"></asp:TextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td nowrap="nowrap" class="td_GuestInfo" align="right">
                                                            Tỉnh, Thành phố:</td>
                                                        <td nowrap="nowrap" align="left">
                                                            <table border="0" cellpadding="0" cellspacing="0">
                                                                <tr>
                                                                    <td>
                                                                        <asp:Label ID="lblPlace" runat="server"></asp:Label></td>
                                                                    <td>
                                                                        <div id="divPlace" style="visibility: hidden">
                                                                            <asp:DropDownList ID="ddlPlace" runat="server">
                                                                            </asp:DropDownList></div>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td align="right" class="td_GuestInfo" nowrap="nowrap">
                                                            <asp:Label ID="Label2" runat="server" Text="Mã số thuế:"></asp:Label></td>
                                                        <td align="left" nowrap="nowrap">
                                                            <asp:TextBox ID="txtTaxNo" runat="server" CssClass="TextBoxToLabel" ValidationGroup="grCustomer"
                                                                Width="222px"></asp:TextBox></td>
                                                    </tr>
                                                    <tr>
                                                        <td class="td_GuestInfo" nowrap="nowrap">
                                                        </td>
                                                        <td align="left" nowrap="nowrap">
                                                            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="grCustomer"
                                                                ForeColor="Red" />
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td align="right" class="td_ContentNews">
                                    <asp:Label ID="lblUSD" runat="server"></asp:Label>
                                    <asp:Label ID="lblUSDHidden" runat="server" Visible="false"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td align="center" class="td_ContentNews">
                                    <asp:GridView ID="grv_Master" runat="server" AutoGenerateColumns="False" BorderStyle="Dotted"
                                        BorderWidth="1px" BorderColor="#FFFFFF" CellPadding="5" OnRowDataBound="grv_Master_RowDataBound"
                                        ShowFooter="True" Width="100%">
                                        <Columns>
                                            <asp:TemplateField HeaderText="Mã Phim">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblMaSP" runat="server" Text='<%# Eval("FilmNo") %>'></asp:Label>
                                                </ItemTemplate>
                                                <ItemStyle CssClass="gv_BorderBasketGrv" Width="5%" HorizontalAlign="Center" />
                                                <HeaderStyle CssClass="gv_BorderBasketGrv" />
                                                <FooterStyle CssClass="gv_BorderBasketGrv" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Tên Phim">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblTenSP" runat="server" Text='<%# Eval("PDName") %>'></asp:Label>
                                                </ItemTemplate>
                                                <ItemStyle CssClass="gv_BorderBasketGrv" Width="40%" HorizontalAlign="Left" />
                                                <HeaderStyle CssClass="gv_BorderBasketGrv" />
                                                <FooterStyle CssClass="gv_BorderBasketGrv" />
                                            </asp:TemplateField>
                                        </Columns>
                                        <EmptyDataTemplate>
                                            <div align="center">
                                                <asp:Label ID="Label1" runat="server" CssClass="lbl_TextDefault" Text="Chưa có sản phẩm nào trong giỏ hàng của bạn"></asp:Label>
                                            </div>
                                        </EmptyDataTemplate>
                                        <RowStyle CssClass="gv_RowStyleBasket" />
                                        <AlternatingRowStyle CssClass="gv_AlternatingRowStyleBasket" />
                                        <HeaderStyle CssClass="gv_HeaderBasket" />
                                        <FooterStyle CssClass="gv_FooterBasket" />
                                    </asp:GridView>
                                </td>
                            </tr>
                            <tr>
                                <td align="left" class="td_ContentNews">
                                    <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                                        <tr>
                                            <td style="width: 5%; white-space: nowrap">
                                                <asp:Label ID="Label3" runat="server" Text="Ghi chú:"></asp:Label></td>
                                            <td>
                                                <asp:TextBox ID="txtNote" runat="server" Height="55px" TextMode="MultiLine" Width="98%"
                                                    CssClass="txt_Common"></asp:TextBox></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td class="td_ContentNews" align="center">
                                    <br />
                                    <asp:Button ID="btnFinish" runat="server" CssClass="btn_Common" Text="Hoàn tất đặt hàng"
                                        ValidationGroup="grCustomer" OnClick="btnFinish_Click" />
                                    <asp:Button ID="Button1" runat="server" CssClass="btn_Common" Text="Trở về giỏ hàng"
                                        OnClick="Button1_Click" /><br />
                                    <br />
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
        </table>
    </div>

    <script language="javascript" type="text/javascript">
            var name=document.getElementById("<%=txtHoTen.ClientID %>")
            var address=document.getElementById("<%=txtDiaChi.ClientID %>")
            var phone=document.getElementById("<%=txtDienThoai.ClientID %>")
            var email=document.getElementById("<%=txtEmail.ClientID %>")
            var place=document.getElementById("<%=lblPlace.ClientID %>")
            var chk=document.getElementById("<%=chkState.ClientID %>")
            var txtTaxNo=document.getElementById("<%=txtTaxNo.ClientID %>")
                 name.readOnly="readOnly";
                 address.readOnly="readOnly";
                 phone.readOnly="readOnly";
                 email.readOnly="readOnly";
                 place.readOnly="readOnly";
                 txtTaxNo.readOnly="readOnly";                
    
    function fnEditPerson(obj)
    {
       
            var name=document.getElementById("<%=txtHoTen.ClientID %>")
            var address=document.getElementById("<%=txtDiaChi.ClientID %>")
            var phone=document.getElementById("<%=txtDienThoai.ClientID %>")
            var email=document.getElementById("<%=txtEmail.ClientID %>")
            var lblPlace=document.getElementById("<%=lblPlace.ClientID %>");
            var ddlPlace=document.getElementById("<%=ddlPlace.ClientID %>");   
            var txtTaxNo=document.getElementById("<%=txtTaxNo.ClientID %>")                     
            var divPlace=document.getElementById("divPlace")            
            var chk=document.getElementById("<%=chkState.ClientID %>")
            if(chk.checked==true)
            {
                name.readOnly=false;
                address.readOnly=false;
                phone.readOnly=false;
                email.readOnly=false;
                place.readOnly=false;   
                txtTaxNo.readOnly=false;                
                name.className="txt_Common";
                address.className="txt_Common";
                phone.className="txt_Common";
                email.className="txt_Common";
                txtTaxNo.className="txt_Common";
                //place.className="txt_Common";
                divPlace.style.visibility="visible";
                place.style.visibility="hidden";
                //place.innerText="";  
                place.innerHTML="";              
                       
                 
            }
            else
            {   
                 name.readOnly="readOnly";
                 address.readOnly="readOnly";
                 phone.readOnly="readOnly";
                 email.readOnly="readOnly";
                 txtTaxNo.readOnly="readOnly";                 
                 place.readOnly="readOnly";
                 name.className="TextBoxToLabel";
                 address.className="TextBoxToLabel";
                 phone.className="TextBoxToLabel";
                 email.className="TextBoxToLabel";
                 place.className="TextBoxToLabel";
                 txtTaxNo.className="TextBoxToLabel";                
                name.value='<%=hName %>'
                address.value='<%=hAddress %>'
                phone.value='<%=hPhone %>'
                email.value='<%=hEmail %>';
                txtTaxNo.value='<%=hTaxNo %>';                
                place.innerHTML='<%=hPlaceNm %>';
                divPlace.style.visibility="hidden";
                place.style.visibility="visible";   
             
                 
            }
        
    }
    
    /*=================Email================*/
    String.prototype.trim = function () {
		return this.replace(/^\s*/, "").replace(/\s*$/, "");
	}
    function fnHideImgEmail()
    {
        var imgStateEmail=document.getElementById("imgStateEmail");
        imgStateEmail.style.visibility="hidden"; 
    }
    function fnCheckEmail(sValue)
    {  
        
        if(sValue.trim()=="")  return;
        Shopping_Order_OrderDetail.AjaxCheckEmail(sValue,CallBackEmail);  

     
    }
    function CallBackEmail(res)
    {
        if(res!=null)
        {
            var flag=res.value;
            if(flag!=null && flag!="")
			{	
			    var imgStateEmail=document.getElementById("imgStateEmail");

			    var hidEmail=document.getElementById("<%= hidEmail.ClientID%>");
			    hidEmail.value="aaa"; //Tranh su kien dang su ly
		
			    if(flag=="yes")
			    {   imgStateEmail.style.visibility="visible";
			        imgStateEmail.src="../../Images/Icon/cmdDelete.gif";
			        imgStateEmail.alt="Email này đã tồn tại";			        
			        hidEmail.value="0";
			       
			    }		
			    else
			    {
			           imgStateEmail.style.visibility="hidden";
			    }	    
			}	
        }
    }
  
    
    </script>

</asp:Content>
